using System.Collections;
using UnityEngine;

public class AnimationPlayDemo : MonoBehaviour
{
	public float playTime = 10f;

	public float dispersion;

	public Animator animator;

	public Animator animatorWeapon;

	private void Start()
	{
		if (animator != null)
		{
			StartCoroutine(PlayDemoAnimation());
		}
	}

	private IEnumerator PlayDemoAnimation()
	{
		yield return new WaitForSeconds(2f);
		while (true)
		{
			animator.SetTrigger("Demo");
			if (animatorWeapon != null)
			{
				animatorWeapon.SetTrigger("WeaponDemo");
			}
			yield return new WaitForSeconds(playTime + Random.Range(0f, dispersion));
		}
	}
}
